#include <utl/image.h>
#include <stb_image.h>

utl::image::image(const char* path)
{
	this->data = stbi_load(path, &this->width, &this->height, &this->channel, 4);
}

//utl::image::image(const std::string& path) :image{ path.c_str() }
//{}

utl::image::image(u8* data, u32 size)
{
	this->data = stbi_load_from_memory(data, size, &this->width, &this->height, &this->channel, 4);
}

utl::image::~image()
{
	if (this->data != nullptr)
	{
		stbi_image_free(this->data);
	}
}

